package com.weita.lightfood.controller;


import com.weita.lightfood.model.entity.Label;
import com.weita.lightfood.service.LabelService;
import com.weita.lightfood.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author IT_Monster at 2019/04/25 19:01.
 * 标签
 */
@Api(tags = "标签管理接口")
@RestController
@RequestMapping("/label")
public class LabelController {
    @Autowired
    private LabelService labelService;

    /**
     * 获取所有标签名
     * @return
     */
    @ApiOperation("获取所有标签名")
    @PostMapping("/getAllLabel")
    public Result<Label> getAllLabel(){
        try {
            return Result.success(labelService.getAll());
        } catch (Exception e) {
            return Result.fail("获取标签出错");
        }
    }
}
